/*
 *  Copyright (c) 2011, StripBandunk and/or its affiliates. All rights reserved.
 * 
 *       http://stripbandunk.com/
 * 
 *  STRIPBANDUNK PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.stripbandunk.tutorial.jlayerdemo;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JComponent;
import javax.swing.plaf.LayerUI;

/**
 *
 * @author Eko Kurniawan Khannedy
 */
public class MyLayer extends LayerUI<PanelMahasiswa> {

    private static final long serialVersionUID = 1L;

    @Override
    public void paint(Graphics g, JComponent c) {
        super.paint(g, c);

        Graphics2D gd = (Graphics2D) g.create();
        gd.setComposite(AlphaComposite.SrcOver.derive(0.5F));

        gd.setColor(Color.YELLOW);
        gd.fillRect(0, 0, c.getWidth() / 2, c.getHeight());

        gd.setColor(Color.RED);
        gd.fillRect(c.getWidth() / 2, 0, c.getWidth(), c.getHeight());

        gd.dispose();
    }
}
